﻿#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLuaBase.lua_CSFunction;
#endif

using XLua;
using System.Collections.Generic;


namespace XLua.CSObjectWrap
{
    using Utils = XLua.Utils;
    public class YoozooManagersNetworkV2UMTNetworkWrap 
    {
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(Yoozoo.Managers.NetworkV2.UMTNetwork);
			Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
			
			
			
			
			
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 8, 0, 0);
			Utils.RegisterFunc(L, Utils.CLS_IDX, "HasNetworkChannel", _m_HasNetworkChannel_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "GetChannel", _m_GetChannel_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "RegisterChannel", _m_RegisterChannel_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "SendBytes", _m_SendBytes_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "Send", _m_Send_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "StartUp", _m_StartUp_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "ShutDown", _m_ShutDown_xlua_st_);
            
			
            
			
			
			
            Utils.RegisterFunc(L, Utils.CLS_IDX, "New", __CreateInstanceNew);
			Utils.EndClassRegister(type, L, translator);
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstance(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 1)
				{
					
					var gen_ret = new Yoozoo.Managers.NetworkV2.UMTNetwork();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to Yoozoo.Managers.NetworkV2.UMTNetwork constructor!");
            
        }

        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstanceNew(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 0)
				{
					
					var gen_ret = new Yoozoo.Managers.NetworkV2.UMTNetwork();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to Yoozoo.Managers.NetworkV2.UMTNetwork constructor!");
            
        }

        
		
        
		
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_HasNetworkChannel_xlua_st_(RealStatePtr L)
        {
		    try {
            
            
            
                
                {
                    string _channelName = LuaAPI.lua_tostring(L, 1);
                    
                        var gen_ret = Yoozoo.Managers.NetworkV2.UMTNetwork.HasNetworkChannel( _channelName );
                        LuaAPI.lua_pushboolean(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_GetChannel_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
                
                {
                    string _channelName = LuaAPI.lua_tostring(L, 1);
                    
                        var gen_ret = Yoozoo.Managers.NetworkV2.UMTNetwork.GetChannel( _channelName );
                        translator.Push(L, gen_ret);
                    
                    
                    
                    return 1;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_RegisterChannel_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
                
                {
                    Yoozoo.Managers.NetworkV2.Core.NetChannel _channel = (Yoozoo.Managers.NetworkV2.Core.NetChannel)translator.GetObject(L, 1, typeof(Yoozoo.Managers.NetworkV2.Core.NetChannel));
                    
                    Yoozoo.Managers.NetworkV2.UMTNetwork.RegisterChannel( _channel );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_SendBytes_xlua_st_(RealStatePtr L)
        {
		    try {
            
            
            
                
                {
                    string _channelName = LuaAPI.lua_tostring(L, 1);
                    int _msgId = LuaAPI.xlua_tointeger(L, 2);
                    byte[] _bytes = LuaAPI.lua_tobytes(L, 3);
                    
                    Yoozoo.Managers.NetworkV2.UMTNetwork.SendBytes( _channelName, _msgId, _bytes );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Send_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
                
                {
                    string _channelName = LuaAPI.lua_tostring(L, 1);
                    int _msgId = LuaAPI.xlua_tointeger(L, 2);
                    object _data = translator.GetObject(L, 3, typeof(object));
                    
                    Yoozoo.Managers.NetworkV2.UMTNetwork.Send( _channelName, _msgId, _data );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_StartUp_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
			    int gen_param_count = LuaAPI.lua_gettop(L);
            
                if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<object>(L, 2)) 
                {
                    string _channelName = LuaAPI.lua_tostring(L, 1);
                    object _customData = translator.GetObject(L, 2, typeof(object));
                    
                    Yoozoo.Managers.NetworkV2.UMTNetwork.StartUp( _channelName, _customData );
                    
                    
                    
                    return 0;
                }
                if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)) 
                {
                    string _channelName = LuaAPI.lua_tostring(L, 1);
                    
                    Yoozoo.Managers.NetworkV2.UMTNetwork.StartUp( _channelName );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
            return LuaAPI.luaL_error(L, "invalid arguments to Yoozoo.Managers.NetworkV2.UMTNetwork.StartUp!");
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_ShutDown_xlua_st_(RealStatePtr L)
        {
		    try {
            
            
            
                
                {
                    string _channelName = LuaAPI.lua_tostring(L, 1);
                    
                    Yoozoo.Managers.NetworkV2.UMTNetwork.ShutDown( _channelName );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        
        
        
        
        
		
		
		
		
    }
}
